<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>支付宝电脑网站支付</title>
<link rel="stylesheet" type="text/css"
	href="../static/css/bao/index_alipay.css" />




</head>
	<%
		//使用form方法获取上层页面传入的phoneid
		String date = request.getParameter("time");
		String buttonValue = request.getParameter("phoneiddown");
	%>

<body>
	
	<%-- 		<%=buttonValue%> --%>

	<header class="am-header">
	<h1>支付宝电脑网站支付入口</h1>
	</header>
	<div id="main">
		<div id="tabhead" class="tab-head">
			<h2 id="tab1" class="selected" name="tab"></h2>

		</div>
		<form name=alipayment action=alipay.trade.page.pay.jsp method=post
			target="_self">
			<div id="body1" class="show" name="divcontent">
				<dl class="content">
<!-- 				使用超连接的方式获取商品的id -->
				<input type="hidden" id="phoneiddown2" name="phoneiddown2" value="${param.phoneid}"/>
					<dt>商户订单号 ：</dt>
					<dd>
						<input id="WIDout_trade_no" name="WIDout_trade_no" />
					</dd>
					<hr class="one_line">
					<dt>订单名称 ：</dt>
					<dd>
						<input id="WIDsubject" name="WIDsubject" />
					</dd>
					<hr class="one_line">
					<dt>付款金额 ：</dt>
					<dd>
						<input id="WIDtotal_amount" name="WIDtotal_amount" />
<!-- 						使用超链接的形式获取购物车的总结 -->
						<input type="hidden" id="sumprice2" name="sumprice2" value="${param.sumprice}"/>
					</dd>
					<hr class="one_line">
					<dt>商品描述：</dt>
					<dd>
						<input id="WIDbody" name="WIDbody" />
					</dd>
					<hr class="one_line">
					<dt>收获地址：</dt>
					<dd>
						<button type="button" class="btn btn-info aaa" onclick="doAddinfo()" style="float:left;">修改收货地址</button>
					</dd>
					<hr class="one_line">
					<dd>	<span id="address">
									  <%=session.getAttribute("recName") %>	
									  <%=session.getAttribute("recTel") %>
									  <%=session.getAttribute("postCode") %>
									  <%=session.getAttribute("recAddress") %>
									  <%=session.getAttribute("addressDetail") %>
						</span>
					</dd>	
					<dd id="btn-dd">
						<span class="new-btn-login-sp">
							<button class="new-btn-login" type="submit" onclick="OrderNum()">付 款</button>
							<button class="new-btn-login" type="button" onclick="goBack()">返回</button>
						</span> <span class="note-help">如果您点击“付款”按钮，即表示您同意该次的执行操作，否则返回前网页</span>
					</dd>
				</dl>
			</div>
		</form>

		<div id="foot">
			<ul class="foot-ul">
				<li>支付宝版权所有 2015-2018 ALIPAY.COM</li>
			</ul>
		</div>
	</div>


</body>
<script type="text/javascript"  src="../static/js/jquery-1.12.4.min.js"></script>
<script type="text/javascript"	src="../static/js/HomePageJs/layer-v3.1.1/layer/layer.js"></script>
<script type="text/javascript"	src="../static/sweetalert/sweetalert.min.js"></script>

<script type="text/javascript">
	$(function() {
			$.ajax({
				type : "POST", // 请求类型
				url : "../AjaxPrice", // 请求的url
				data : "phoneid=" +	$("#phoneiddown2").val(),// 发送的数据 使用serialize方法替代手动拼写数据串   
				dataType : "json",
				success : function(data, textStatus, jqXHR) {
				$.each(data,function(index, eachVal) {
				//alert(eachVal.phonename);
				//var phonename = eachVal.phonename;
				//var phoneprice = eachVal.phoneprice;
				document.getElementById("WIDsubject").value = eachVal.phonename;
				//判断一下是否为购物车的价格
				document.getElementById("WIDtotal_amount").value = eachVal.phoneprice;
				document.getElementById("WIDbody").value = eachVal.pintroduce;
				});
				}
			});
			//调用订单编号
		GetDateNow();
// 		console.info(GetDateNow());
		//如果收货地址为null，则不显示
		addressNull();
	});
	
	</script>
	<script type="text/javascript">	
		//设置订单编号
		function GetDateNow() {
			var vNow = new Date();
			var sNow = "";
			sNow += String(vNow.getFullYear());
			sNow += String(vNow.getMonth() + 1);
			sNow += String(vNow.getDate());
			sNow += String(vNow.getHours());
			sNow += String(vNow.getMinutes());
			sNow += String(vNow.getSeconds());
			sNow += String(vNow.getMilliseconds());
			document.getElementById("WIDout_trade_no").value = sNow;
		}
		</script>
		<script type="text/javascript">
	//如果收货地址为null，则不显示
	function addressNull(){
		if($("#address").text == null){
			$("#address").text("");
		}
	}	
	// 返回历史上层页面
	function goBack() {
		window.history.back();
	}
	</script>
	<script type="text/javascript">
	
	//将订单号发存入数据库
	function OrderNum(){
		$.ajax({
			type : "POST", // 请求类型
			url : "../OrderNum", // 请求的url
			data : "phoneid=" +	$("#phoneiddown2").val() + "&" + "usertel=" + <%=session.getAttribute("userTel")%> + "&" + "orderNum=" + $("#WIDout_trade_no").val(),// 发送的数据 使用serialize方法替代手动拼写数据串   
			dataType : "json",
// 			success : function(data, textStatus, jqXHR) {
				
// 			}
		});
	}
	</script>
	<script type="text/javascript">
	//弹出新增加收货地址
	function doAddinfo() {
		layer.open({
			type: 2,
			title: '新增收货地址',
			maxmin: true,
			area: ['800px', '400px'],
			content: '../cwx/addinfo.jsp'
		});
// 		layer.full(index);//全屏
	};
</script>
<html>